home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Your Choice 3
/
Your Choice Software Collection 3.iso
/
dos
/
colprint
/
rap.doc
< prev
next >
Wrap
Text File
|
1994-06-26
|
11KB
|
236 lines
Rap version 1.3
June 25, 1994
Copyright (C) 1992-1994 by Thomas M. Roddy
All Rights Reserved.
Introduction:
Rap is a "word wrap" utility program which is used to reformat a text file
into specified line lengths without splitting up words across lines. If a
word will not fit at the end of a line, then the entire word will start
the next line. This differs from programs which reformat text files to a
given line length regardless of the word boundaries.
The shareware version of Rap is restricted in one way. To encourage
registration, it will only process the first 120,000 characters of a file.
This should be adequate to test the usefulness of the program. Please
register if you find Rap useful. You will be mailed the latest version of
the program without the shareware notice and with the restriction removed.
Version 1.3 differs from version 1.2 in that Rap will now accept "piping".
By using the -P option, Rap will read from standard input and/or write
to standard output. Also, the shareware version of Rap will now process
twice as many characters as version 1.2. In addition, modifications
have been made to the documentation and order form.
License and distribution information:
Rap is shareware. It is not public domain or free software. An order form
is enclosed in the file named ORDER.FRM. After trying it out for 14 days, if
you like it and want to continue using it, please register by sending the
registration fee (located in ORDER.FRM) with your name and address along with
any comments or questions to the address listed.
You may NOT alter the code nor may you sell this program or any of its
associated data files for any price. You may charge a reasonable copy
fee of not more than US$10 when distributing it to others as long as you
clearly stipulate that Rap must be registered with its author if it is
used beyond the trial period. Every copy of the ZIP distribution file
must contain all of the files listed below.
You may (and are encouraged to) distribute the shareware version of Rap
to others. Under no circumstances may you distribute a registered version
of Rap to others.
Disclaimer:
The author makes no claims or guarantees about the use of Rap and will
not be responsible for any loss, including data or profits, due its use
or misuse.
Compatibility:
Rap should work with all standard ASCII files. It has not been tested with
files containing control characters commonly found in documents in specific
word processing formats such as Word Perfect or Microsoft Word. Most
word processors allow you to convert documents to ASCII format. You should
do this before using Rap on the documents. Alternatively, you can use
the utilities in the File Format Utilities to get your text into an
acceptable format. See the bottom of this document for more information.
Rap should work with UNIX generated files which may have line feeds
without the accompanying carriage returns generally found in MS-DOS
generated files. It should also work with Macintosh generated files.
The output file generated by Rap will, however, have a carriage return
and line feed at the end of each line.
Files in distribution:
RAP.EXE - Rap executable program
RAP.DOC - This file - Documentation for Rap
ORDER.FRM - Printable order form for registering programs
FILE_ID.DIZ - Short description of Rap
Product description:
Rap will "word wrap" lines of text to fit into the line width specified
on the command line. If a full word cannot fit on the end of one line,
the entire word is wrapped to the next line. Rap will not hypenate words
that are not already hypenated, but will unhyphenate words that are hyphen-
ated at the end of a line (as in the above line) since the hyphenation is
meaningless (actually confusing and incorrect) if it appears in the middle
of a line after being reformatted by Rap.
If a line width is not specified, then Rap will default to the largest line
width it supports which is 2147483647 characters per line. This effectively
removes all line breaks within a paragraph. Acceptable values are from 10 to
2147483647 and can be specified using the /W option. Most other word wrap
programs can not handle line lengths this long. This useful when dealing
with long paragraphs which contain no line breaks. The paragraph appears
as one very large line.
Rap also allows you to specify the size of the two internal buffers which
are used in processing the file. The default sizes for the two buffers are
2048 bytes each. You can modify this value by using the /B option. Acceptable
values are from 128 to 30208 bytes. If performance is critical, you could
optimize the processing time by setting these buffer sizes, but in my testing
2048 bytes seems to be the most efficient value.
Using the /M option will activate "margin mode" to also wrap paragraphs that
have an indented starting position.
Specifying the output file name is optional. If no output file name is given,
the output file name will default to the input file name with the extension
.RAP appended to it. For example, the input file TEXTFILE would default to
the output file TEXTFILE.RAP while TEXTFILE.TXT would also default to
TEXTFILE.RAP. Rap will error if the input file has the same name as the
output file.
Many word processing programs reformat paragraphs themselves depending
on how many characters can fit on a line. This is frequently dependent
upon font size, margins, etc. By removing the "line breaks", these programs
can process the file better because they don't have to worry about "line
breaks" which are already in the file. Rap is therefore very useful when
converting documents between different word processors. In some cases, you
may want to put in line breaks after 80 characters, while other times you
may want to strip out all the line breaks within a paragraph and let the
word processor do the reformatting.
Most word processor programs save their files in a proprietary format with
control characters. If the text file is not in ASCII format, you must convert
it to ASCII. Most word processors allow you to do this.
Reformatting documents using word wrap programs often have undesirable side
effects so this type of text processing is dependent upon the text files you
want to print.
Usage: Rap infile [-Wm] [-Bn] [-M] [-P] [outfile]
where m is the desired line width:
minimum=10, maximum=2147483647, default=2147483647
where n is the desired buffer size
minimum=128, maximum=30208, default=2048
where M implements margin mode.
-P indicates that piping of input and/or output is being performed
Examples:
RAP TEXTFILE.TXT /W76
Reformats TEXTFILE.TXT into 76 characters per line and writes
it to TEXTFILE.RAP
RAP TEXTFILE.TXT
Reformats TEXTFILE.TXT into 2147483647 characters per line and
writes it to TEXTFILE.RAP. This effectively removes all line breaks
within paragraphs. Useful for importing the document to word
processors which do not like line breaks.
RAP TEXTFILE.TXT /W50
Reformats TEXTFILE.TXT into 50 characters per line and writes
it to TEXTFILE.RAP. This is useful for printing the output file
in three columns (using ColPrint) on a printer that supports 160
characters per line (20 cpi) mode.
RAP TEXTFILE.TXT /W50 /B8096 TEXT2.TXT
Reformats TEXTFILE.TXT into 50 characters per line and writes
it to TEXT2.TXT. The two internal buffers are each 8 KB in
size.
RAP TEXTFILE.TXT /W50 /B8096 /M TEXT2.TXT
Reformats TEXTFILE.TXT into 50 characters per line and writes
it to TEXT2.TXT. The two internal buffers are each 8 KB in
size. If an entire paragraph is indented, then it will also be
"word wrapped" while maintaining the indentation.
RAP.EXE should be placed in a directory which is in your search PATH so that
you can run the program from within other directories.
Miscellaneous information:
When using the -P option, you should not specify file names for output
and possibly not even for input. If you are piping data as standard input
into Rap, but want to save the results to a file, you should use DOS
redirection to do this since if only one file name is listed in the
command line, it will be assumed to be the output file's name.
Example: TYPE INPUT.DOC | Rap -W72 -P > OUTPUT.DOC
Warning: you are not legally allowed to modify many copyrighted software
manuals. This program should be used on your own personal files or with the
permission of the document's author.
I have written several utilities to aid you in preprocessing text files
so that Rap can work better on more formats of documents. These utility
programs are grouped together and called the File Format Utilities and
can be found as FFU10.ZIP on many BBS's. This package is also Shareware.
The purpose of the File Format Utilities is to aid in preparing documents
so that they are in a format that other text processing programs can
systematically work with. Programs that perform functions such as "word wrap"
will be able to reformat documents with minimal problems if the document
follows a few rules. The following utilities help you modify document files
to adhere to these rules. The utilities that make up the package are
listed below with very brief descriptions:
FixEOLs - Converts all lines to end in an ASCII standard CR/LF character pair
Untab - Expands TAB characters to any number of spaces
Strip - Removes given characters from a file
Parafy - Insert blank line if a line begins past acceptable margin
FixShort -Insert blank line after short lines
FndStart -Insert blank line after lines which begin with a given string
FndRep - Finds a given string and removes or replaces it with another
If you are looking for a printing program to print your files into newspaper
style columns, take a look at another shareware program by this author called
ColPrint. ColPrint is compatible with many dot matrix, DeskJet, and laser
printers. The file is COLPR21.ZIP and is on many BBS's. If you can't find it
on your local BBS, download it from CompuServe. If you do not have access to
CompuServe, send $5 to the address below and I'll mail you a Shareware copy
to evaluate or send $9.95 + $1 (shipping/handling) for a registered
unrestricted version.
The official distribution site for the programs is the Programmers Corner BBS
in Columbia, Maryland (410) 995-6874. You can be sure of having the latest
version of Rap if you download it from there. CompuServe will have it soon
after the Programmers Corner. I can also be reached on the Programmers Corner
BBS for technical support by sending a message to Tom Roddy.
The author can also be contacted by US mail, CompuServe, or the Internet:
Thomas M. Roddy CompuServe ID: 73730,3304
7158 Harp String Internet: 73730.3304@compuserve.com
Columbia, MD 21045
Trademarks are the property of their respective owners.